#pragma once

#include "lg2d.h"

#include "lg_ref.h"

struct LG2DObj{
    LGRef ref;
    LGVector position;
    LGVector scale;
    LGFloat rotate;
    LGMatrix transform;
    int dirty;
    int visible;
    LG2DObj** children;
    LG2DObj* childrenCache[8];
    unsigned count;
    unsigned cap;
    LG2DObj* parent;
    unsigned index;
    LGRefFree free;
    void (*visit)(LG2DObj* obj, LGMatrix* m, int force);
    void (*draw)(LG2DScene* scene, LG2DObj* obj);
};


extern void
lg2dVisitObj(void* obj, LGMatrix* transfor, int force);
extern void
lg2dDrawObj(LG2DScene* scene, LG2DObj* obj);